package com.sjgtw.cloud.web.expert.controller;

import com.sjgtw.cloud.common.core.web.controller.BaseController;
import com.sjgtw.cloud.common.core.web.domain.AjaxResult;
import com.sjgtw.cloud.common.core.web.page.TableDataInfo;
import com.sjgtw.cloud.web.expert.domain.ExpertDatabase;
import com.sjgtw.cloud.web.expert.domain.ExpertType;
import com.sjgtw.cloud.web.expert.service.ExpertDatabaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 专家库管理Controller
 * 
 * @author ruoyi
 * @date 2024-03-16
 */
@RestController
@Api(tags = "专家库管理")
@RequestMapping("/expert")
public class ExpertDatabaseController extends BaseController
{
    @Autowired
    private ExpertDatabaseService expertDatabaseService;


    /**
     * 查询专家库管理列表
     */

    @GetMapping("/getExpertTypeList")
    @ApiOperation("获取类型管理数据")
    public AjaxResult getExpertTypeList()
    {
        List<ExpertType> list = expertDatabaseService.getExpertTypeList();
        return AjaxResult.success(list);
    }

    /**
     * 新增专家库管理
     */

    @PostMapping("/addExpertType")
    @ApiOperation("新增类型管理数据")
    public AjaxResult addExpertType(@RequestBody ExpertType expertType)
    {
        return toAjax(expertDatabaseService.addExpertType(expertType));
    }



    /**
     * 删除类型管理数据
     */

    @GetMapping("/deleteExpertType")
    @ApiOperation("删除类型管理数据")
    public AjaxResult deleteExpertType(Long expertTypeId)
    {
        return toAjax(expertDatabaseService.deleteExpertType(expertTypeId));
    }


    /**
     * 查询专家库管理列表
     */
    @GetMapping("/list")
    @ApiOperation("查询专家库管理列表")
    public TableDataInfo list(ExpertDatabase expertDatabase)
    {
        startPage();
        List<ExpertDatabase> list = expertDatabaseService.selectExpertDatabaseList(expertDatabase);
        return getDataTable(list);
    }



    /**
     * 新增专家库管理
     */
    @PostMapping("/add")
    @ApiOperation("新增专家库管理")
    public AjaxResult add(@RequestBody ExpertDatabase expertDatabase)
    {
        return toAjax(expertDatabaseService.insertExpertDatabase(expertDatabase));
    }

    /**
     * 修改专家库管理
     */
    @PutMapping("/edit")
    @ApiOperation("修改专家库管理")
    public AjaxResult edit(@RequestBody ExpertDatabase expertDatabase)
    {
        return toAjax(expertDatabaseService.updateExpertDatabase(expertDatabase));
    }

    /**
     * 删除专家库管理
     */
    @ApiOperation("删除专家库管理")
	@DeleteMapping("/delete/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(expertDatabaseService.deleteExpertDatabaseById(id));
    }
}
